home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / bipl.zip / PROGS.ZIP / IVERSION.ICN < prev    next >
Text File  |  1992-11-26  |  1KB  |  48 lines

  1. ############################################################################
  2. #
  3. #    File:     iversion.icn
  4. #
  5. #    Subject:  Program to show icode version
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     September 2, 1991
  10. #
  11. ###########################################################################
  12. #
  13. #    This program reports the version of Icon icode files whose names
  14. #  are supplied, one name per line, from standard input.
  15. #
  16. #    The method is necessarily somewhat heuristic and may not work on
  17. #  all systems and for very old icode versions.
  18. #
  19. ############################################################################
  20.  
  21. procedure main()
  22.    local name, file, icode, okay
  23.  
  24.    while name := read() do {
  25.       writes(name, ": ")
  26.       file := open(name,"u") | {
  27.          write("cannot open")
  28.          next
  29.          }
  30.       okay := &null
  31.       while icode := reads(file,30000) do    # enough for most UNIX headers
  32.          icode ? {
  33.             while tab(upto('I') + 1) do {
  34.                if any('5678') then {
  35.                   write(tab(upto('\0')))
  36.                   okay := 1
  37.                   break
  38.                   }
  39.                }
  40.             }
  41.       if /okay then write("no version; may not be icode file")
  42.       close(file)
  43.       }
  44.  
  45. end
  46.  
  47.  
  48.